if(exists(select * from sysobjects where name = 'chk_user' ))
drop procedure chk_user
go
 
create procedure chk_user 
(
		@user       varchar(35) = '',
		@password	varchar(35) = ''
)
with encryption
as
begin
 
	set nocount on
	
	select userid,
	       loginname, 
	       userrights, 
	       mandid, 
	       username, 
	       beschreibung 
	  from userrights 
	 where loginname = @user
	   and pwdcompare(@password, password) = 1	
 
end
go

print 'Procedure: chk_user done ...'
go
grant exec on chk_user to prsadmins with grant option
go
grant exec on chk_user to prsusers
go


